﻿using AnesSystem.Models;
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnesSystem.Services
{
    public class PatientLisDataService : BaseService<PatientLisDataService, PatientLisDataModel>
    {
        // 通过时间查找
        public PatientLisDataModel GetPatientDrugs8PatientID(String pid)
        {
            var filter = Builders<BsonDocument>.Filter;
            var query = Builders<BsonDocument>.Filter.And(
                filter.Eq("PatientID", pid));
            if (FindAll(query).ToList() == null || FindAll(query).ToList().Count < 1)
            {
                return null;
            }
            return FindAll(query).ToList().First();
        }

        public void addUpdate(PatientLisDataModel patientLisDataModel)
        {          
                Update(patientLisDataModel);
        }
    }
}
